<% layout('layout') %><!--加载全局布局文件-->
<style>
    .am-form-group{
        margin-bottom:1em !important;
    }
    [class*=am-align-]{
        margin-bottom: 0em !important;
    }
</style>
<div ng-controller="AddrCtrl" ng-cloak class="ng-cloak">
    <div ng-repeat="addr in addrs"   class="am-margin-sm scor-border-radius-5 scor-border-bbb scor-border-set-{{addr.isDefault}}">
                <p class="am-margin-sm"><span class="scor-color-red scor-font-weight-700">收&nbsp;&nbsp;件&nbsp;&nbsp;人&nbsp;：</span><span ng-bind="addr.name"></span><span class="am-margin-left" ng-bind="addr.phone"></span></p>
                <p class="am-margin-sm"><span class="scor-color-red scor-font-weight-700 ">地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;址：</span><span ng-bind="addr.address"></span></p>
                <hr class="am-margin-vertical-sm am-margin-horizontal-sm" />
                <div class="am-g am-padding-bottom-sm">

                    <div class="scor-color-FFF am-u-sm-12 am-margin-left ">
                            <button ng-click="setDefaultAddress($index,addr.objectId)" ng-if="!addr.isDefault" class="scor-bg-gr scor-border-none am-padding-xs am-padding-horizontal-sm scor-border-radius-5">设为默认</button>
                            <button ng-if="addr.isDefault" class="addr-det-btn scor-bg-FFF scor-color-red scor-border-red am-margin-left-xs am-padding-xs  scor-border-radius-5 ">当前地址</button>
                            <button ng-click="getEditAddress($index,addr)" class="scor-bg-gr scor-border-none am-padding-xs am-padding-horizontal scor-border-radius-5 am-margin-left-xs">编辑</button>
                            <button ng-click="deleteAddress($index,addr.objectId)" class="addr-det-btn scor-bg-FFF scor-border-gr am-margin-left-xs am-padding-xs am-padding-horizontal scor-border-radius-5 scor-color-gr-font" >删除</button>
                    </div>
                </div>
    </div>
    <div ng-click="addAddressForm()" class="am-margin-sm scor-color-008000"><i  class="am-icon-plus-circle"></i>&nbsp;<span class="scor-color-008000" ng-click="addAddress()">新增地址</span></div>
    <input type="hidden" id="backurl" value="<%= backurl %>">
    <div class="am-modal am-modal-loading am-modal-no-btn"  tabindex="-1" id="icon-alert">
        <div class="am-modal-dialog scor-bg-opacity">
            <div class="am-modal-hd scor-color-FFF"><i class="am-icon-spinner am-icon-spin scor-font-size-40"></i></div>
        </div>
    </div>

    <div class="am-modal am-modal-prompt scor-left-0 scor-bg-F8F8F8 "tabindex="-1" id="form-alert">
        <div class="am-modal-dialog scor-width-height-100 am-margin-0">
            <span data-am-modal-close  class="am-close am-close-alt am-close-spin am-icon-times am-align-right am-margin-right-sm am-margin-top-xs"></span>
            <div class="scor-height-40 scor-color-gr-font   scor-font-weight-700 am-padding-top-sm " ng-bind="formTitle"></div>
              <form class="am-form"   data-am-validator ng-submit="saveAddress()">
                 <div class="am-modal-bd  scor-border-none scor-bg-F8F8F8" style="padding: 0px 10px 0px 10px;">

                     <input ng-if="noObjectid" type="hidden" id="objectId" name="objectId" ng-model="value.objectId" class="scor-bg-F8F8F8 am-form-field  scor-text-indent">
                     <div class="am-form-group am-form-icon  ">
                        <label for="name" class="am-align-left">收货人：</label>
                        <i class="am-icon-user scor-color-gr-bg"></i>
                        <input  type="text" id="name" name="name" ng-model="value.name" class="scor-bg-F8F8F8 am-form-field  scor-text-indent" placeholder="请输入收货人姓名" required>
                     </div>

                    <div class="am-form-group am-form-icon   ">
                        <label for="phone" class="am-align-left">联系号码：</label>
                        <i class="am-icon-phone scor-color-gr-bg"></i>
                        <input  type="tel" id="phone" name="phone" minlength="8" ng-model="value.phone" required class="am-form-field scor-text-indent scor-bg-F8F8F8" placeholder="请输入有效联系电话">
                    </div>

                    <div class="am-form-group am-form-icon    " >
                        <label for="address" class="am-align-left">收货地址：</label>

                        <textarea class="scor-bg-F8F8F8" rows="5" id="address" name="address" ng-model="value.address" placeholder="街道/小区地址详细的订单优先处理"></textarea>

                    </div>
                 </div>
                 <div class="am-modal-footer am-margin-0 scor-bg-F8F8F8">
                    <div class="am-form-group am-text-center scor-height-140">
                        <button type="submit" id="addAddressBtn"  class="am-btn am-btn-warning scor-border-radius-5 am-padding-horizontal-lg">保存</button>
                    </div>
                 </div>
            </form>
        </div>
    </div>
</div>
<!--如果本页面有额外的js文件/代码需要加入到head中 使用如下代码-->
<!--<% block('footer').append('<script src="'+CDN+'/ng/angular-resource.min.js"></script>') %>-->
<% block('footer').append('<script src="'+CDN+'script/address.js"></script>') %>
